package testBoard;

import static org.junit.Assert.*;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

import org.junit.Test;
import board.*;

public class TestPrintTable {

	@Test
	public void testRepaint() {
		
		class BoardStub extends Board{		
			@Override
			public String[][] getGameBoard() {
				String[][] test = new String[21][21];
				for (int i=0; i<21;i++)
					for (int j=0; j<21; j++)
						test[i][j]="1";
				return test;
			}
		}
		
		ByteArrayOutputStream testOut = new ByteArrayOutputStream();
		PrintStream testOutPrintStream = new PrintStream(testOut);
		System.setOut(testOutPrintStream);
		
		PrintTable pT = new PrintTable();
		BoardStub gameBoard = new BoardStub();
		pT.repaint(gameBoard);
		
		String newLine = System.getProperty("line.separator");
		if (newLine == null) newLine = "\n";
		
		String expected = "";
		for (int i=0; i<21; i++)
			for (int j=0; j<21; j++)
				expected+="111111111111111111111"+newLine;
		
		assertEquals(expected, testOut.toString());
	}
}
